/*#include <iostream>
 
 #include <GLUT/glut.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <math.h>
 #include <unistd.h>
 #include <limits.h>
 #include <time.h>
 #include <math.h>
 
 
 #include "../../api/inc/fmod.h"
 #include "../../api/inc/fmod.hpp"
 #include "../../api/inc/fmod_errors.h"
 GLint flag1x =1
 , flag2x =1
 , flag1y = 1
 , flag2y =1
 , width =1
 , height=1;
 GLfloat diffuseMaterial[4] = { 0.5, 0.5, 0.5, 1.0 }, x1=0, x2=0, y=0, y2=0,
 tmp, radius =.5, diameter=2*radius, x1inc=.01, x2inc=.01, y1inc=.01, y2inc=0, 
 x1pos=0, x2pos =0, y1pos=0, y2pos=0, PI = 3.14159265;
 
 /*  Initialize material property, light source, lighting model,
 *  and depth buffer.
 */
void init(void) 
{
	GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 };
	GLfloat light_position[] = { 0.0, 1.0, 1.0, 0.0 };
	
	glClearColor (0.0, 0.0, 0.0, 0.0);
	x1pos=1;
	x2pos=-1;
	glShadeModel (GL_SMOOTH);
	glEnable(GL_DEPTH_TEST);
	/*glMaterialfv(GL_FRONT, GL_DIFFUSE, diffuseMaterial);
	 glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
	 glMaterialf(GL_FRONT, GL_SHININESS, 25.0);
	 glLightfv(GL_LIGHT0, GL_POSITION, light_position);
	 glEnable(GL_LIGHTING);
	 glEnable(GL_LIGHT0);
	 
	 glColorMaterial(GL_FRONT, GL_DIFFUSE);
	 glEnable(GL_COLOR_MATERIAL);*/
}

void display(void)
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	
	
	//Sphere-1 offset on the right side
	glLoadIdentity();
	glPushMatrix();
	glTranslatef(x1+1, 0, 0);
	glutWireSphere(radius, 20, 10);
	
	glPopMatrix();
	glPushMatrix();
	
	//Sphere-2 on the left
	glTranslatef(x2-1, y, 0);
	glutWireSphere(radius, 30, 20);
	glPopMatrix();
	
	//X-coordinate controls for sphere-1
	if (x1+diameter>=width) {
		flag1x = 0;
	}
	else if (x1+diameter<=-width) {
		flag1x = 1;
	}
	if (!flag1x) {
		x1=x1-x1inc;
		x1pos=x1pos-x1inc;
	}
	else {
		x1=x1+x1inc;
		x1pos=x1pos+x1inc;
	}
	
	//y-coordinate controls for sphere-1
	if (y>=height) {
		flag1y = 0;
	}
	else if (y<=-height) {
		flag1y = 1;
	}
	if (!flag1y) {
		y=y-y1inc;
		y1pos=y1pos-y1inc;
	}
	else {
		y=y+y1inc;
	}
	
	//X-coordinate controls for sphere-2
	if (x2>=width+diameter) {
		flag2x = 0;
	}
	else if (x2<=-width+diameter) {
		flag2x = 1;
	}
	if (!flag2x) {
		x2=x2-x2inc;
		x2pos=x2pos-x2inc;
	}
	else {
		x2=x2+x2inc;
		x2pos=x2pos+x2inc;
	}
	
	//y-coordinate controls for sphere-2
	if (y2>=height) {
		flag2y = 0;
	}
	else if (y2<=-height) {
		flag2y = 1;
	}
	if (!flag2y) {
		y2=y2-y2inc;
	}
	else {
		y2=y2+y2inc;
	}
	printf("%f\n", (fabs(radius*sin((PI/2.0)*(x2pos-x1pos))) + fabs(radius*cos((PI/2.0)*(y1pos-y2pos)))));
	
	if  ((fabs(radius*sin((M_PI/2.0)*(x2pos-x1pos))) + fabs(radius*cos((M_PI/2)*(y1pos-y2pos)))) >=diameter-.01) { 
		printf("yay");
		flag1x=(flag1x+1)%2;
		flag1y=(flag1y+1)%2;
		flag2x=(flag2x+1)%2;
		flag2y=(flag2y+1)%2;
		
	}
	
	
	glFlush();
	glutSwapBuffers();
	
}

void timer(int extra) {
	glutPostRedisplay();
	glutTimerFunc(30, timer, 0);
}

void reshape (int w, int h)
{
	glViewport (0, 0, (GLsizei) w, (GLsizei) h);
	glMatrixMode (GL_PROJECTION);
	glLoadIdentity();
	if (w <= h)
		glOrtho (-1.5, 1.5, -1.5*(GLfloat)h/(GLfloat)w,
				 1.5*(GLfloat)h/(GLfloat)w, -10.0, 10.0);
	else
		glOrtho (-1.5*(GLfloat)w/(GLfloat)h,
				 1.5*(GLfloat)w/(GLfloat)h, -1.5, 1.5, -10.0, 10.0);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
}



void keyboard(unsigned char key, int xc, int yc)
{
	switch (key) {
		case 27:
			exit(0);
			break;
		case 'p':
			printf("rsinx = %f\n", 
				   fabs(radius*sin((PI/2.0)*(x2pos-x1pos))) + fabs(radius*cos((PI/2)*(y2pos-y1pos))));
			break;
	}
}

int main(int argc, char** argv)
{
	glutInit(&argc, argv);
	glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
	glutInitWindowSize (500, 500); 
	glutInitWindowPosition (100, 100);
	glutCreateWindow (argv[0]);
	init ();
	glutDisplayFunc(display); 
	glutReshapeFunc(reshape);
	
	glutKeyboardFunc(keyboard);
	glutTimerFunc(30, timer, 0);
	glutMainLoop();
	return 0;
}
*/
